package com.anjie.powerproject.repository;

import com.anjie.powerproject.entity.HistoryData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

public interface HistoryDataRepository extends JpaRepository<HistoryData,Integer> {

    @Query(nativeQuery = true,value = "SELECT history_data.* FROM history_data WHERE DATE_FORMAT(history_data.sdate,'%m-%d')=?1")
    List<HistoryData> findHistoryDataByDateTime(String MMdd);

    @Query(nativeQuery = true, value = "select * from history_data where CAST(`sdate` as DATE)=CAST(?1 as DATE) and strategy_type=?2 and graph_id=?3")
    List<HistoryData> findHistoryDataByDateAndType(Date sdate, Integer type, Integer graphId);
}
